package com.yunhe.control;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.yunhe.bean.Board;
import com.yunhe.bean.ShopImfor;
import com.yunhe.service.GoodsBoardService;

/**
 * Servlet implementation class getBoardClassify
 */
/*@WebServlet(name = "getBoardClassify.do", urlPatterns = { "/getBoardClassify.do" })*/
@WebServlet("/getBoardClassify.do")
public class getBoardClassify extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public getBoardClassify() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		String bid = request.getParameter("bid");
		if(bid != null) {
			List<Board> list = new GoodsBoardService().getboardList(Integer.parseInt(bid));
			session.setAttribute("list", list);
			request.getRequestDispatcher("hou/goods-classify.jsp").forward(request, response);
		}else {
			//List<Board> list = new GoodsBoardService().getboard();//数据总条数
			//request.setAttribute("list", list);
			request.getRequestDispatcher("getBoardFenYe.do").forward(request, response);
			//response.sendRedirect("hou/goods-classify.jsp");
		}
		
	}

}
